package hystrix.service;

import feign.hystrix.FallbackFactory;
import hystrix.client.ProviderClient;
import org.springframework.stereotype.Component;

@Component
public class HystrixCustomerFallbackFactory implements FallbackFactory<ProviderClient> {
    @Override
    public ProviderClient create(Throwable cause){
        return new ProviderClient() {
            //当c1发送异常时触发
            @Override
            public String c1() {
                return "hystrix_customer_error_c1";
            }
            //当c2发送异常时触发
            @Override
            public String c2(){
                return "hystrix_customer_error_c2";
            }
            //当c1发送异常时触发
            @Override
            public String c3() {
                return "hystrix_customer_error_c3";
            }
            //当c2发送异常时触发
            @Override
            public String c4(){
                return "hystrix_customer_error_c4";
            }
        };
    }
}
